package me.springboot.mybatis.exception;

import me.springboot.mybatis.core.RetCode;

import java.io.Serializable;

public class ResultException extends Exception implements Serializable {

    private static final long serialVersionUID = 3857309446472590497L;

    /**
     * 错误代码
     */
    private int code;
    /**
     * 错误信息
     */
    private String message;
    private Exception ex;

    public ResultException(RetCode retCode) {
        super();
        this.code = retCode.getCode();
        this.message = "";
    }

    public ResultException(int code, String message) {
        super();
        this.code = code;
        this.message = message;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    @Override
    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Exception getEx() {
        return ex;
    }

    public void setEx(Exception ex) {
        this.ex = ex;
    }

    public static long getSerialversionuid() {
        return serialVersionUID;
    }

}
